<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="__PUBLIC__/admin/sncss/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="__PUBLIC__/admin/sncss/css/timeselector.css">

</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
		<li><a>首页</a></li>
		<li><a>自媒体管理</a></li>
		<li><a>添加主体字数</a></li>
	<li><a onClick="javascript:history.back(-1);">返回</a></li>
		</ul>
		</div>

		<div class="formbody">

		<div class="formtitle"><span>账户信息</span></div>
			<form id="formid" name="form1" method="post" action="{:U('/Home/Media/add_words')}" onsubmit="return form1_submit();">
		<input name="mmid"  type="hidden" class="dfinput" value="{$mmid}" />
		<input name="jumpurl"  type="hidden" class="dfinput" value="{$jumpurl}" />
		<ul class="forminfo">
		<li><label>账户编号</label><input type="text" class="dfinput" value="{$mediadata['mmid']}" disabled /><i></i></li>
		<li><label>手机号</label><input type="text" class="dfinput" value="{$mediadata['media_tel']}" disabled /><i></i></li>
		<li><label>自媒体名称</label><input type="text" class="dfinput" value="{$mediadata['media_name']}" disabled /><i></i></li>
		<li><label>当前字数</label><input type="text" class="dfinput" value="{$mediadata['wordnumber']}" disabled /><i></i></li>
		<li><label>交易状态</label>
			<select class="dfinput" id="pay_state" name="pay_state" >
				<option  value="0" >请选择</option>
				<option  value="1" >已支付</option>
				<option  value="2" >未支付</option>
				<option  value="3" >赠送</option>
				<option  value="4" >补单</option>
				<option  value="5" >自用</option>
			</select>
		</li>
			<li><label>添加字数</label><input name="wordnumber" id="wordnumber" type="text" class="sminput" style="width: 120px;" value="" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" />字<font style="color:red;display: none;" id="wordnumber_isrequire">(必填)</font></li>
		<li><label>赠送字数</label><input name="grantnumber" id="grantnumber" type="text" class="sminput" style="width: 120px;" value="" onkeyup="this.value=this.value.replace(/[^\d]/g,'');" />字<font style="color:red;display: none;" id="grantnumber_isrequire">(必填)</font></li>
		<li><label>签约金额</label><input name="signmoney" id="signmoney" type="text" class="sminput" style="width: 120px;" value="" />元<font style="color:red;display: none;" id="signmoney_isrequire">(必填)</font></li>
		<li><label>支付方式</label>
			<select class="dfinput" id="sign_payment" name="sign_payment" >
				<option  value="0" >请选择</option>
				<option  value="1" >支付宝</option>
				<option  value="2" >对公转账</option>
			</select>
			<font style="color:red;display: none;" id="sign_payment_isrequire">(必填)</font>
		</li>
		<li><label>套餐选择</label>
			<select class="dfinput" id="wordtype" name="wordtype" >
				<option  value="0" >请选择</option>
				<volist name="payword_arr" id="vo">
					<option  value="{$vo.id}" >{$vo.money}元充值{$vo.word}字</option>
				</volist>
			</select>
			<font style="color:red;display: none;" id="wordtype_isrequire">(必填)</font>
		</li>
		<li><label>交易流水号</label><input name="serial_number" id="serial_number" type="text" class="sminput" style="width: 205px;" value="" /><font style="color:red;display: none;" id="serial_number_isrequire">(必填)</font></li>
		<!--<li><label>合同号</label><input name="contract_number" id="contract_number" type="text" class="sminput" style="width: 205px;" value="" /></li>-->
		<li><label>备注</label><input type="text" name="remark" id="remark" class="lginput" value="" /><i></i></li>
		<li><label>&nbsp;</label><label>&nbsp;</label></li>
		<li><label>&nbsp;</label>
		<input type="submit" class="btn" value="确认添加"/>
		</li>
		</ul>
			</form>

		</div>

</body>
<script src="__PUBLIC__/js/jquery1.8.3.js"></script>
<script src="__PUBLIC__/layer/layer.js"></script>
<script type="text/javascript">
$('#pay_state').change(function () {
    var this_pay_state = $(this).val();
    switch (this_pay_state){
		case ("1"):
		    $('#wordnumber_isrequire').show();//添加字数
            $('#grantnumber_isrequire').hide();//赠送字数
		    $('#signmoney_isrequire').show();//签约金额
		    $('#sign_payment_isrequire').show();//支付方式
		    $('#wordtype_isrequire').show();//套餐选择
		    $('#serial_number_isrequire').show();//交易流水号
		    break;
		case ("2"):
            $('#wordnumber_isrequire').show();//添加字数
            $('#grantnumber_isrequire').hide();//赠送字数
            $('#signmoney_isrequire').show();//签约金额
            $('#sign_payment_isrequire').hide();//支付方式
            $('#wordtype_isrequire').show();//套餐选择
            $('#serial_number_isrequire').hide();//交易流水号
            break;
        case ("3"):
            $('#wordnumber_isrequire').hide();//添加字数
            $('#grantnumber_isrequire').show();//赠送字数
            $('#signmoney_isrequire').show();//签约金额
            $('#sign_payment_isrequire').hide();//支付方式
            $('#wordtype_isrequire').hide();//套餐选择
            $('#serial_number_isrequire').hide();//交易流水号
			break;
		case ("4"):
            $('#wordnumber_isrequire').show();//添加字数
            $('#grantnumber_isrequire').hide();//赠送字数
            $('#signmoney_isrequire').show();//签约金额
            $('#sign_payment_isrequire').hide();//支付方式
            $('#wordtype_isrequire').hide();//套餐选择
            $('#serial_number_isrequire').hide();//交易流水号
			break;
		case ("5"):
            $('#wordnumber_isrequire').show();//添加字数
            $('#grantnumber_isrequire').hide();//赠送字数
            $('#signmoney_isrequire').show();//签约金额
            $('#sign_payment_isrequire').hide();//支付方式
            $('#wordtype_isrequire').hide();//套餐选择
            $('#serial_number_isrequire').hide();//交易流水号
			break;
    }
})
</script>
<script type="text/javascript">
		function form1_submit(){
				var wordnumber= $('#wordnumber').val();//添加字数
				var grantnumber= $('#grantnumber').val();//赠送字数
				var signmoney= $('#signmoney').val();//签约金额
				var wordtype= $('#wordtype').val();//套餐选择
            	var pay_state = $("#pay_state").val();//支付状态
            	var sign_payment = $("#sign_payment").val();//支付方式
            	var serial_number = $("#serial_number").val();//交易流水号
            	if(pay_state==0){
                    layer.msg('请选择交易状态');return false;
				}else if(pay_state==1){
					if(wordnumber.length==0||wordnumber==0){
						layer.msg('请填写添加字数');return false;
					}
					if(signmoney.length==0||signmoney==0){
						layer.msg('请填写签约金额');return false;
					}
                    if(wordtype==0){
                        layer.msg('请选择套餐');return false;
                    }
                    if(sign_payment==0){
                        layer.msg('请填写支付方式');return false;
                    }
                    if(serial_number==''){
                        layer.msg('请填写交易流水号');return false;
                    }
				}else if(pay_state==2){
                    if(wordnumber.length==0||wordnumber==0){
                        layer.msg('请填写添加字数');return false;
                    }
                    if(signmoney.length==0||signmoney==0){
                        layer.msg('请填写签约金额');return false;
                    }
                    if(wordtype==0){
                        layer.msg('请选择套餐');return false;
                    }
				}else if(pay_state==3){
                    if(grantnumber.length==0||grantnumber==0){
                        layer.msg('请填写赠送字数');return false;
                    }
                    if(signmoney.length==0||signmoney==0){
                        layer.msg('请填写签约金额');return false;
                    }
				}else if(pay_state==4){
                    if(wordnumber.length==0||wordnumber==0){
                        layer.msg('请填写添加字数');return false;
                    }
                    if(signmoney.length==0||signmoney==0){
                        layer.msg('请填写签约金额');return false;
                    }
				}else if(pay_state==5){
                    if(wordnumber.length==0||wordnumber==0){
                        layer.msg('请填写添加字数');return false;
                    }
                    if(signmoney.length==0||signmoney==0){
                        layer.msg('请填写签约金额');return false;
                    }
				}
		}
</script>

</html>
